package mspbots.teams.client.core.data.planners;

import com.fasterxml.jackson.databind.JsonNode;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

/**
 * GroupsController
 *
 * @author <a href="https://github.com/vnobo">Alex bob</a>
 * @date Created by 2020/8/31
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("planners/{tenantId}")
public class PlannersController {

    private final PlannersServiceImpl plannersService;

    @GetMapping("plans")
    public Flux<JsonNode> find(@PathVariable Long tenantId) {
        return this.plannersService.find(tenantId);
    }

    @GetMapping("groups")
    public Flux<JsonNode> groups(@PathVariable Long tenantId) {
        return this.plannersService.getGroups(tenantId);
    }

}
